package com.mccabe;

import java.io.*;
import java.util.*;
import java.net.*;
import java.lang.*;

/**********************************************************************
 * McCabe Path Vector Instrumentation Class.
 *
 * @author McCabe & Associates, Inc.
 * @version $Revision: 1.24 $ $Date: 2002/01/24 20:17:25 $
 **********************************************************************/
public class PathVec_ERS_Iter3
{
    // QA 15900 - Java / PROGRAM_NAME
    private static final Object syncObj = new Object();

    /**********************************************************************
     * User configurable flags
     **********************************************************************/
    static boolean append = true;       // Append to trace file?
    static boolean branchOnly = false;  // Branch only coverage?
    static boolean autoFlush = true; // Flush trace file after every write

    // Internal variables
    static boolean fatalError = false;
    static boolean fileOpen = false;
    static boolean disableInstrumentation = false;
    static PrintWriter traceFile;
    static Hashtable hTable;

    // shutdown in progrss
    static boolean shutDownInProgress = false;    //QA11358

    // coverage server variables
    static boolean use_connection = false;
    static Client coverageClient;
    static boolean connected = false;
    static String coverageServer = null;

    // performance mods for java instrumentation with CS
    static boolean cs_synchronous = false;    //QA11399
    static boolean cs_buffered_vector = true;  //QA11394

    // static covserver_viewer cs_viewer = null;

    static final int NO_COVERAGE_SERVER = 0;    //added for Coverage Server, 11/17/00 - Suresh TP
    static final int SPECIFIED_COVERAGE_SERVER_ONLY = 1; //added for Coverage Server, 11/17/00 - Suresh TP
    static final int CHECK_HOSTS_FILE = 2;    //added for Coverage Server, 11/17/00 - Suresh TP

    static boolean test_compress_is_active = false; //QA11393

    static String traceFilename =
"%n_inst.out"
    ;
    static String programName =
"ERS_Iter3"
    ;

    /* Coverage Server replacements, 11/20/00 - Suresh TP */
    static int csOption =
NO_COVERAGE_SERVER
    ;
    static String csHostName =
"null"
    ;
    static short csPort =
5150
    ;
    static String csInstOut =
""
    ;
    static int csAutoActiveTest =
0
    ;
    /* End of Coverage Server replacements, 11/20/00 - Suresh TP */

    static int MAX_FI_SIZE =
1000
    ;

    static class sdf1
    {
        static  _McFileInfo_ERS_Iter3[] fileInfo =
        {
 new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\AsyncBot.java",0,3,0,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\Driver.java",3,1,3,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\Facade.java",4,5,4,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\ManualOperationStrategy.java",9,7,9,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\MultithreadingTestOperationStrategy.java",16,1,16,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\OperationStrategy.java",17,0,17,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\RequestView.java",17,1,17,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\ViewAllEventsRequestView.java",18,2,18,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\ViewBookingsForEventAdminRequestView.java",20,2,20,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\Administrator.java",22,1,22,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\AdminRequest.java",23,6,23,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\ClientPerson.java",29,1,29,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\CreateBookingRequest.java",30,7,30,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\CreateEventAdminRequest.java",37,12,37,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\Request.java",49,4,49,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\RequestProcessor.java",53,2,53,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\RequestStatus.java",55,0,55,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\UserRequest.java",55,1,55,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\ViewAllEventsRequest.java",56,5,56,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\ViewBookingsForEventAdminRequest.java",61,7,61,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\Booking.java",68,8,68,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\BookingManager.java",76,6,76,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\Catalog.java",82,4,82,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\Event.java",86,17,86,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\EventSpecification.java",103,5,103,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\EventStatus.java",108,0,108,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\Person.java",108,6,108,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\Seat.java",114,7,114,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\Venue.java",121,7,121,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\VenueTimeslot.java",128,5,128,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Service\\EventClosedException.java",133,1,133,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Service\\InputManager.java",134,1,134,false)
,new _McFileInfo_ERS_Iter3("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Service\\OutputManager.java",135,3,135,false)
        };
    }

    static Object[] sdf_list  =
    {
        sdf1.fileInfo
    };

    static int numFiles =
33
    ;
    static int[] eventFrequency;

    static int MAX_EVR_SIZE =
1000
    ;

    static class sde1
    {
        static boolean[] eventReturn =
        {
 true
,true
,false
,false
,true
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,true
,false
,false
,false
,false
,false
,true
,true
,true
,true
,true
,true
,true
,false
,true
,true
,false
,false
,true
,false
,false
,false
,false
,false
,false
,false
,false
,true
,false
,false
,false
,false
,true
,false
,true
,true
,true
,false
,false
,true
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,false
,true
,false
,true
,true
,true
,false
,true
,true
,false
,true
,true
,true
,true
,false
,false
,false
,true
,true
,false
,true
,true
,false
,false
,false
,true
,true
,false
,true
,true
,true
,true
,true
,true
,false
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,false
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,false
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,false
,false
,true
,true
,true
,true
,true
,false
,true
,true
,true
,true
,true
,true
,true
,true
,false
,false
,false
,false
,false
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,false
,false
,false
,false
,false
,true
,false
,true
,false
,false
,false
,false
,false
,false
,false
,true
,true
,true
,true
,true
,true
,true
,true
,true
,false
,false
,true
,false
,true
,false
,false
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,false
,false
,false
,false
,false
,true
,false
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,true
,false
,false
,true
,true
,true
,true
,true
,true
,false
,false
,true
,false
,false
,false
,false
,true
,true
,false
,false
,true
        };
    }

    static Object[] event_list  =
    {
        sde1.eventReturn
    };

    static int MAX_MI_SIZE =
1000
    ;

    static class sdm1
    {
        static  _McModInfo_ERS_Iter3[] moduleInfo =
        {
 new _McModInfo_ERS_Iter3 (1,0,20)
,new _McModInfo_ERS_Iter3 (1,1,20)
,new _McModInfo_ERS_Iter3 (15,2,20)
,new _McModInfo_ERS_Iter3 (7,17,20)
,new _McModInfo_ERS_Iter3 (4,24,20)
,new _McModInfo_ERS_Iter3 (1,28,20)
,new _McModInfo_ERS_Iter3 (1,29,20)
,new _McModInfo_ERS_Iter3 (1,30,20)
,new _McModInfo_ERS_Iter3 (1,31,20)
,new _McModInfo_ERS_Iter3 (3,32,20)
,new _McModInfo_ERS_Iter3 (9,35,20)
,new _McModInfo_ERS_Iter3 (3,44,20)
,new _McModInfo_ERS_Iter3 (9,47,20)
,new _McModInfo_ERS_Iter3 (7,56,20)
,new _McModInfo_ERS_Iter3 (33,63,20)
,new _McModInfo_ERS_Iter3 (3,96,20)
,new _McModInfo_ERS_Iter3 (4,99,20)
,new _McModInfo_ERS_Iter3 (1,103,20)
,new _McModInfo_ERS_Iter3 (7,104,20)
,new _McModInfo_ERS_Iter3 (1,111,20)
,new _McModInfo_ERS_Iter3 (7,112,20)
,new _McModInfo_ERS_Iter3 (1,119,20)
,new _McModInfo_ERS_Iter3 (1,120,20)
,new _McModInfo_ERS_Iter3 (1,121,20)
,new _McModInfo_ERS_Iter3 (3,122,20)
,new _McModInfo_ERS_Iter3 (1,125,20)
,new _McModInfo_ERS_Iter3 (1,126,20)
,new _McModInfo_ERS_Iter3 (1,127,20)
,new _McModInfo_ERS_Iter3 (1,128,20)
,new _McModInfo_ERS_Iter3 (1,129,20)
,new _McModInfo_ERS_Iter3 (1,130,20)
,new _McModInfo_ERS_Iter3 (1,131,20)
,new _McModInfo_ERS_Iter3 (1,132,20)
,new _McModInfo_ERS_Iter3 (1,133,20)
,new _McModInfo_ERS_Iter3 (1,134,20)
,new _McModInfo_ERS_Iter3 (1,135,20)
,new _McModInfo_ERS_Iter3 (4,136,20)
,new _McModInfo_ERS_Iter3 (1,140,20)
,new _McModInfo_ERS_Iter3 (1,141,20)
,new _McModInfo_ERS_Iter3 (1,142,20)
,new _McModInfo_ERS_Iter3 (1,143,20)
,new _McModInfo_ERS_Iter3 (1,144,20)
,new _McModInfo_ERS_Iter3 (1,145,20)
,new _McModInfo_ERS_Iter3 (1,146,20)
,new _McModInfo_ERS_Iter3 (1,147,20)
,new _McModInfo_ERS_Iter3 (1,148,20)
,new _McModInfo_ERS_Iter3 (1,149,20)
,new _McModInfo_ERS_Iter3 (1,150,20)
,new _McModInfo_ERS_Iter3 (4,151,20)
,new _McModInfo_ERS_Iter3 (1,155,20)
,new _McModInfo_ERS_Iter3 (1,156,20)
,new _McModInfo_ERS_Iter3 (1,157,20)
,new _McModInfo_ERS_Iter3 (1,158,20)
,new _McModInfo_ERS_Iter3 (1,159,20)
,new _McModInfo_ERS_Iter3 (1,160,20)
,new _McModInfo_ERS_Iter3 (1,161,20)
,new _McModInfo_ERS_Iter3 (1,162,20)
,new _McModInfo_ERS_Iter3 (5,163,20)
,new _McModInfo_ERS_Iter3 (1,168,20)
,new _McModInfo_ERS_Iter3 (1,169,20)
,new _McModInfo_ERS_Iter3 (3,170,20)
,new _McModInfo_ERS_Iter3 (1,173,20)
,new _McModInfo_ERS_Iter3 (1,174,20)
,new _McModInfo_ERS_Iter3 (1,175,20)
,new _McModInfo_ERS_Iter3 (1,176,20)
,new _McModInfo_ERS_Iter3 (1,177,20)
,new _McModInfo_ERS_Iter3 (1,178,20)
,new _McModInfo_ERS_Iter3 (8,179,20)
,new _McModInfo_ERS_Iter3 (1,187,20)
,new _McModInfo_ERS_Iter3 (1,188,20)
,new _McModInfo_ERS_Iter3 (1,189,20)
,new _McModInfo_ERS_Iter3 (1,190,20)
,new _McModInfo_ERS_Iter3 (1,191,20)
,new _McModInfo_ERS_Iter3 (1,192,20)
,new _McModInfo_ERS_Iter3 (1,193,20)
,new _McModInfo_ERS_Iter3 (1,194,20)
,new _McModInfo_ERS_Iter3 (1,195,20)
,new _McModInfo_ERS_Iter3 (17,196,20)
,new _McModInfo_ERS_Iter3 (1,213,20)
,new _McModInfo_ERS_Iter3 (1,214,20)
,new _McModInfo_ERS_Iter3 (1,215,20)
,new _McModInfo_ERS_Iter3 (1,216,20)
,new _McModInfo_ERS_Iter3 (1,217,20)
,new _McModInfo_ERS_Iter3 (1,218,20)
,new _McModInfo_ERS_Iter3 (1,219,20)
,new _McModInfo_ERS_Iter3 (7,220,20)
,new _McModInfo_ERS_Iter3 (1,227,20)
,new _McModInfo_ERS_Iter3 (1,228,20)
,new _McModInfo_ERS_Iter3 (1,229,20)
,new _McModInfo_ERS_Iter3 (1,230,20)
,new _McModInfo_ERS_Iter3 (1,231,20)
,new _McModInfo_ERS_Iter3 (1,232,20)
,new _McModInfo_ERS_Iter3 (1,233,20)
,new _McModInfo_ERS_Iter3 (1,234,20)
,new _McModInfo_ERS_Iter3 (1,235,20)
,new _McModInfo_ERS_Iter3 (1,236,20)
,new _McModInfo_ERS_Iter3 (1,237,20)
,new _McModInfo_ERS_Iter3 (1,238,20)
,new _McModInfo_ERS_Iter3 (1,239,20)
,new _McModInfo_ERS_Iter3 (1,240,20)
,new _McModInfo_ERS_Iter3 (9,241,20)
,new _McModInfo_ERS_Iter3 (1,250,20)
,new _McModInfo_ERS_Iter3 (1,251,20)
,new _McModInfo_ERS_Iter3 (1,252,20)
,new _McModInfo_ERS_Iter3 (1,253,20)
,new _McModInfo_ERS_Iter3 (1,254,20)
,new _McModInfo_ERS_Iter3 (1,255,20)
,new _McModInfo_ERS_Iter3 (1,256,20)
,new _McModInfo_ERS_Iter3 (1,257,20)
,new _McModInfo_ERS_Iter3 (1,258,20)
,new _McModInfo_ERS_Iter3 (1,259,20)
,new _McModInfo_ERS_Iter3 (1,260,20)
,new _McModInfo_ERS_Iter3 (1,261,20)
,new _McModInfo_ERS_Iter3 (1,262,20)
,new _McModInfo_ERS_Iter3 (1,263,20)
,new _McModInfo_ERS_Iter3 (1,264,20)
,new _McModInfo_ERS_Iter3 (1,265,20)
,new _McModInfo_ERS_Iter3 (1,266,20)
,new _McModInfo_ERS_Iter3 (1,267,20)
,new _McModInfo_ERS_Iter3 (1,268,20)
,new _McModInfo_ERS_Iter3 (1,269,20)
,new _McModInfo_ERS_Iter3 (1,270,20)
,new _McModInfo_ERS_Iter3 (1,271,20)
,new _McModInfo_ERS_Iter3 (1,272,20)
,new _McModInfo_ERS_Iter3 (1,273,20)
,new _McModInfo_ERS_Iter3 (1,274,20)
,new _McModInfo_ERS_Iter3 (1,275,20)
,new _McModInfo_ERS_Iter3 (1,276,20)
,new _McModInfo_ERS_Iter3 (3,277,20)
,new _McModInfo_ERS_Iter3 (1,280,20)
,new _McModInfo_ERS_Iter3 (1,281,20)
,new _McModInfo_ERS_Iter3 (1,282,20)
,new _McModInfo_ERS_Iter3 (1,283,20)
,new _McModInfo_ERS_Iter3 (1,284,20)
,new _McModInfo_ERS_Iter3 (7,285,20)
,new _McModInfo_ERS_Iter3 (1,292,20)
,new _McModInfo_ERS_Iter3 (1,293,20)
,new _McModInfo_ERS_Iter3 (3,294,20)
        };
    }

    static Object[] sdm_list  =
    {
        sdm1.moduleInfo
    };

    static int MAX_MODMAP_SIZE =
1000
    ;

    static class sdmod1
    {
        static  int[] moduleMap =
        {
 0
,1
,2
,3
,4
,5
,6
,7
,8
,9
,10
,11
,12
,13
,14
,15
,16
,17
,18
,19
,20
,21
,22
,23
,24
,25
,26
,27
,28
,29
,30
,31
,32
,33
,34
,35
,36
,37
,38
,39
,40
,41
,42
,43
,44
,45
,46
,47
,48
,49
,50
,51
,52
,53
,54
,55
,56
,57
,58
,59
,60
,61
,62
,63
,64
,65
,66
,67
,68
,69
,70
,71
,72
,73
,74
,75
,76
,77
,78
,79
,80
,81
,82
,83
,84
,85
,86
,87
,88
,89
,90
,91
,92
,93
,94
,95
,96
,97
,98
,99
,100
,101
,102
,103
,104
,105
,106
,107
,108
,109
,110
,111
,112
,113
,114
,115
,116
,117
,118
,119
,120
,121
,122
,123
,124
,125
,126
,127
,128
,129
,130
,131
,132
,133
,134
,135
,136
,137
        };
    }

    static Object[] modmap_list  =
    {
        sdmod1.moduleMap
    };



    static
    {
        synchronized (syncObj) {
            eventFrequency = new int[
297
            ];

            /**********************************************************************
             * Static initializer for PathVec_ERS_Iter3 class
             **********************************************************************/
            String threadName = Thread.currentThread().getName();  //QA11916
            // QA11296, 11387 begin
try{  //QA11916 QA12034
Runtime.getRuntime().addShutdownHook(new Thread()
{
public void run()
{
try
{
shutDownInProgress = true;
endTrace();
}
catch (Exception exc) {}
catch (Error error){}
}
}
);
}
catch(RuntimeException rt){} //QA12034
catch(Error err){}  //QA12034
            // QA11296, 11387 end

            hTable =  new Hashtable();
            if (csOption == SPECIFIED_COVERAGE_SERVER_ONLY)
            {
                coverageServer = csHostName;
            }
            else if (csOption == CHECK_HOSTS_FILE)
            {
                String ch_name = "coverage_server";
                try
                {
                    InetAddress coverage_host = InetAddress.getByName (ch_name);
                    ch_name = coverage_host.getHostAddress ();
                    coverage_host = InetAddress.getByName (ch_name);
                    coverageServer = coverage_host.getHostName ();
                }
                catch (UnknownHostException e)
                {
                    coverageServer = null;
                }
            }

            if (threadName.indexOf("applet") != -1)
            {
                if (csOption == NO_COVERAGE_SERVER)
                {
                    String errMsg = new String ("Applets require the coverage server, but NO_COVERAGE_SERVER is specified in the PCF file");
                    String[] text =    {"ERROR: " + errMsg,"No coverage information will be written."};

                    // QA# 13962 - PathVec_ERS_Iter3 library may throw an ArrayIndexOutOfBoundsException if the user does not close the "Error Dialog"
                    fatalError = true;
                    // end QA# 13962
                    // better QA 11358 begin
                    try
                    {
                        if (shutDownInProgress == false)
                        {
														System.err.println("McCabe Instrumentation: " + text);
                        }
                    }
                    catch (Exception ex){}
                    catch (Error err){}    // end better QA11358
                }
                else
                {
                    use_connection = true;
                    openConnection();
                }
            }
            else if (coverageServer != null)
            {
                use_connection = true;
                openConnection();
            }
            else
            {
                openTraceFile();
            }
        }
    }

    /**********************************************************************
     * Returns the int[] of the current thread. If there is not one, it creates
     * an int[] of size equal to the number of events in the module whose index
     * is iModIndex.
     *
     * @param iModIndex       module index
     *
     * QAID-10109. This method is added by Ravi on 06/23/00.
     **********************************************************************/
    public static int[] getIntArray(int iModIndex)
    {
        int[] intArray;
       /* iModIndex parameter becomes useless because of this change. Leaving
        * it since the instrumented code will not compile, when it it calls this function.
        * By Ravi for QAID-10320 on 10/25/00.
        */

        /* If there is no entry for the current thread in the hashtable,
         * create an int[] for this thread and put it in the hashtable.
         */
        String threadFrameId = obtainThreadFrameId();
        if (!hTable.containsKey(threadFrameId))
        {
            /* We are going to allocate an array of size = the highest number of events
             * possible for a module in whole of the program.
             * By Ravi for QAID-10320 on 10/25/2000.
             */

            final int MaxEvents  = /* QA12448 JLR - Moved Var. from class to local scope & added MCCABE_REPLACE  */
33
            ;

            intArray = new int[MaxEvents + 1]; // Extra 1 for flush indicator
            for (int i=0; i < intArray.length; i++)
            {
                intArray[i] = 0;
            }
            hTable.put(threadFrameId, intArray);
        }

        /* Get the current thread's int[] from the table. */
        intArray = (int[]) hTable.get(threadFrameId);

        return intArray;
    }

    /**********************************************************************
     * Removes the current thread entry from the table.
     *
     * QAID-10109. This method is added by Ravi on 06/23/00.
     **********************************************************************/
    public static void releaseIntArray()
    {
        // If there is an entry for the current thread in the hashtable, get
        // the int[] and remove the entry.
        hTable.remove(obtainThreadFrameId());
    }

    private static String obtainThreadFrameId()
    {
        // This generates a string that should uniquely identify the current
        // thread and stack frame count of the calling user module. It does
        // this by counting the number of stack trace frames, as printed by
        // an exception, starting with the frames outside of this class.
        StringWriter writer = new StringWriter();
        new Throwable().printStackTrace(new PrintWriter(writer));
        BufferedReader reader = new BufferedReader(new StringReader(writer.toString()));
        int frameCounter = 0;
        String line = null;
        try
        {
            for (int i = 0; (line = reader.readLine()) != null; i++)
            {
                if (i > 0 && line.indexOf(PathVec_ERS_Iter3.class.getName()) == -1)
                {
                    frameCounter++;
                }
            }
        }
        catch (Throwable t)
        {
        }
        return Thread.currentThread().hashCode() + "-" + frameCounter;
    }

    /**********************************************************************
     * Connects to the coverage server. It tries to connect for a maximum of
     * three times.
     * Added for QAID-11038 by Ravi on 09/10/2001.
     *
     **********************************************************************/
    static boolean connect(Client coverageServerClient)
    {
        int times = 0;
        while (times < 3)
        {
            if (coverageServerClient.connect())
            {
                return true;
            }
            times++;

            if ( times < 3)
            {
                try
                {
                    /* sleep for one second */
                    Thread.sleep(1000);
                }
                catch ( Exception e)
                {
                    /* don't do anything */
                }
            }
        }
        return false;
    }

    /**********************************************************************
     * Initialize socket connection
     *
     **********************************************************************/
     static void openConnection()
     {
        int slash_ind;
        int ind;
        int x;
        int y;
        String dir_name;
        String file_name;
        String local_name;
        String outFile = expandTraceName(csInstOut);
        String host_name = null;
        InetAddress local;
        _McFileInfo_ERS_Iter3[] fileInfo ;

        fileInfo = (_McFileInfo_ERS_Iter3 []) sdf_list [0];

        if (coverageServer != null)
        {
            // if cs_synchronous is false, don't wait for responses
            //QA11399
            coverageClient = new Client(csPort, cs_synchronous);
            coverageClient.setServer(coverageServer);

            /* Commented the check below since we are going to call connect() which
             * tries to connect thrice. By Ravi for QAID-11038 on 09/10/2001.
             */
            // if (coverageClient.connect())
            if (connect(coverageClient))
            {
                coverageClient.sendStream(String.valueOf(100) + String.valueOf('\36') + "Java");
                //QA11399 begin
                if (cs_synchronous && coverageClient.get_response () == false)
                {
                    // errro
                    fatalError = true;
                }

                coverageClient.sendStream (String.valueOf (700) + String.valueOf('\36') + "200");
                if (cs_synchronous && coverageClient.get_response () == false)
                {
                    // errro
                    fatalError = true;
                }

                coverageClient.sendStream (String.valueOf (703) + String.valueOf('\36') + programName);
                if (cs_synchronous && coverageClient.get_response () == false)
                {
                    // errro
                    fatalError = true;
                }

                // NO_ACK mod
                if (!(cs_synchronous))
                {
                    coverageClient.sendStream(String.valueOf(707) + String.valueOf('\36') +"no_ack");
                }   //QA11399 end

                //we dont care which direction the last goes, we just need to know where it is
                //coverage server will take care of the direction
                x = outFile.lastIndexOf ('\\');
                y = outFile.lastIndexOf ('/');

                if ( x > y)
                {
                    slash_ind = x;
                }
                else
                {
                    slash_ind = y;
                }

                if (slash_ind >= 0)
                {
                    slash_ind++;
                    dir_name = outFile.substring (0, slash_ind);
                    file_name = outFile.substring (slash_ind);

                    coverageClient.sendDirName (dir_name);
                    coverageClient.sendFileName (file_name);
                }
                else
                {
                    coverageClient.sendFileName(outFile);
                }
                connected = true;
/*
                csAutoActiveTest = 0;    // turn off for custoimer use for now
                if (csAutoActiveTest == 1)
                {
                    cs_viewer = new covserver_viewer (coverageServer, fileInfo[0].fileName, programName, csPort);

                    coverageClient.add_cs (cs_viewer);
                }
*/
            }
            else
            {
                String errMsg = coverageClient.getErrorMessage();
                String[] text =    {"ERROR: " + errMsg,"No coverage information will be written."};

                // QA# 13962 - PathVec_ERS_Iter3 library may throw an ArrayIndexOutOfBoundsException if the user does not close the "Error Dialog"
                fatalError = true;
                /* Stop processing events if we could not connect to the coverage server.
                 * By Ravi for QAID-11038 on 09/10/2001
                 */
                disableInstrumentation = true;
                // end QA# 13962
                // better QA 11358 begin
                try
                {
                    if (shutDownInProgress == false)
                    {
												System.err.println("McCabe Instrumentation: " + text);
                    }
                }
                catch (Exception ex){}
                catch (Error err){}    // end better QA11358
            }
        }
        else
        {
            String[] text =
                {"ERROR: ID of coverage server could not be established - check hosts file.",
                             "No coverage information will be written."};
            // QA# 13962 - PathVec_ERS_Iter3 library may throw an ArrayIndexOutOfBoundsException if the user does not close the "Error Dialog"
            fatalError = true;
            /* Stop processing events if we could not connect to the coverage server.
             * By Ravi for QAID-11038 on 09/10/2001
             */
            disableInstrumentation = true;
            // end QA# 13962
            // better QA 11358 begin
            try
            {
                if (shutDownInProgress == false)
                {
										System.err.println("Coverage Info: " + text);
                }
            }
            catch (Exception ex){}
            catch (Error err){}    // end better QA11358
        }
    }

    /**********************************************************************
     * Initialize local file stream
     *
     **********************************************************************/
     static void openTraceFile()
     {
        String outFile;
        outFile = expandTraceName(traceFilename);
        try
        {
            File instOutFileLoc = new File(outFile);
            FileWriter file = new FileWriter(instOutFileLoc.getAbsolutePath(), append);
            traceFile = new PrintWriter(file, autoFlush);
            fileOpen = true;
            // QA 15914 - For Java Instrumentation library - Output the trace file
            // location to a file with date/time stamp to the user's directory
            try {
                String mcOutFileLoc = System.getProperty("user.home") + System.getProperty("file.separator") + ".mccabeout";
                PrintWriter outFileLoc = new PrintWriter(new FileWriter(mcOutFileLoc, append), autoFlush);
                outFileLoc.println("ProgramName: " + programName + "\t OutFileLocation: " + instOutFileLoc.getAbsolutePath() +
                                   "\t " + Calendar.getInstance().getTime().toString());
                outFileLoc.flush();
                outFileLoc.close();
            }
            catch (Exception exc) {}
            // end QA 15914
        }
        catch (IOException error)
        {
            System.err.println("Error Opening " + outFile);
            fatalError = true;
        }
    }

    /**********************************************************************
     * Expand the specified trace name.
     * %n becomes the program name
     * %t becomes the number of milliseconds since January 1, 1970, 00:00:00 GMT
     *
     * @param Original Trace name before expansions
     **********************************************************************/
    static String expandTraceName(String Original)
    {
        StringBuffer newString = new StringBuffer(Original.length());

        for(int i=0; i < Original.length(); i++)
        {
            if (Original.charAt(i) == '%')
            {
                if (Original.charAt(i+1) == 'n')
                {
                    newString.append(programName);
                    i++;
                }
                else if (Original.charAt(i+1) == 't')
                {
                    Date now = new Date();
                    newString.append(now.getTime());
                    i++;
                }
                else
                {
                    newString.append(Original.charAt(i));
                }
            }
            else
            {
                newString.append(Original.charAt(i));
            }
        }
        return(newString.toString());
    }

    /**********************************************************************
     * Dump the cumulative frequencies for the entire program.
     **********************************************************************/
    static void dumpCumulativeFrequencies()
    {
        int iModBase, iModReal, iEventBase, iEventReal;
        int iNumEvents;
        int j;
        boolean nonzero;
        _McFileInfo_ERS_Iter3[] fileInfo ;
        _McModInfo_ERS_Iter3[] moduleInfo;
        int sdm_list_index;
        int sdm_index;

        for (j = 0; j < sdf_list.length; j++)            // each array of file names
        {
            fileInfo = (_McFileInfo_ERS_Iter3 []) sdf_list [j];
            for (int iFile = 0; iFile < fileInfo.length; iFile++)
            {
                iModBase = fileInfo[iFile].iModuleCompBase;
                if (fileInfo[iFile].initialized)
                { /* some coverage in file */
                    for (int iMod = 0; iMod < fileInfo[iFile].cModules; iMod++)
                    {
                        iModReal = iModBase + iMod;
                        nonzero = false;

                        sdm_list_index = get_sdm_list_index (iModReal);
                        sdm_index = get_sdm_index (iModReal);

                        moduleInfo = (_McModInfo_ERS_Iter3 []) sdm_list [sdm_list_index];

                        iEventBase = moduleInfo[sdm_index].iEventBase;
                        iNumEvents = moduleInfo[sdm_index].cEvents;

                        for (int iEvent = 0; iEvent < moduleInfo[sdm_index].cEvents; iEvent++)
                        {
                              iEventReal = iEventBase + iEvent;
                              if (eventFrequency[iEventReal]!=0)
                              {
                                  nonzero = true;
                              }
                        }

                        if (nonzero)
                        {
                            int[] frequencies = new int[iNumEvents];
                            for (int i=0; i < iNumEvents; i++)
                            {
                                frequencies[i] = eventFrequency[iEventBase+i];
                            }
                            transmitVector(iModReal, frequencies, 1);
                        }
                     }
                 }
             }
         }
     }

    /**********************************************************************
     * Class Finalization.  Dump any cached info and close the files.
     **********************************************************************/
    static void endTrace()
    {
        if (fatalError)
            return;
        // dumpCumulativeFrequencies();
        if(fileOpen)
        {
            synchronized (traceFile)
            {
                traceFile.flush();
                traceFile.close();
                fileOpen = false;
            }
        }

        if (use_connection)
        {
            if (coverageClient != null)
            {
                coverageClient.disConnect();  //QA11391
            }
        }
    }

    /**********************************************************************
     * Compare arrays.  Assume A2 is 1 longer than A1 and position A2[0]
     * is bogus
     *
     * @param A1 First array to compare
     * @param A2 Second array to compare
     **********************************************************************/
    static private boolean contentsEqual(int[] A1, int[] A2)
    {
        boolean equal = true;
        for(int i=0; i < A1.length && equal; i++)
        {
            equal = (A1[i] == A2[i+1]);
        }
        return(equal);
    }

    /**********************************************************************
     * Check to see if the path is in the cache if it is increase the
     * frequency counter. (column 0)
     * Replace using LFU.
     *
     * @param moduleId  Id for the module
     * @param freqArray Array to be checked
     **********************************************************************/
    static private boolean cacheHit(int moduleId, int[] freqArray)
    {
        int cRow, cCol, freqMin, iRowMin;
        int[][] cache;
        boolean hit = false;
        _McModInfo_ERS_Iter3[] moduleInfo;
        int sdm_list_index;
        int sdm_index;

        sdm_list_index = get_sdm_list_index (moduleId);
        sdm_index = get_sdm_index (moduleId);

        moduleInfo = (_McModInfo_ERS_Iter3 []) sdm_list [sdm_list_index];

        if (moduleInfo[sdm_index].cCacheRows > 0) {
            cRow = moduleInfo[sdm_index].cCacheRows;
            cCol = moduleInfo[sdm_index].cEvents + 1; /* col 0 is frequency for LFU */
            cache = moduleInfo[sdm_index].getCache();
            freqMin = cache[0][0];
            iRowMin = 0;
            for (int iRow = 0; iRow < cRow; iRow++)
            {
                if (contentsEqual(freqArray, cache[iRow]))
                { /* hit */
                    cache[iRow][0]++;
                    hit = true;
                    break;
                }
                if (cache[iRow][0] < freqMin)
                { /* find min frequency row */
                    freqMin = cache[iRow][0];
                    iRowMin = iRow;
                }
            }
            if (!hit)
            {
                cache[iRowMin][0] = 1;
                for(int iCol = 1; iCol < cCol; iCol++)
                {
                    cache[iRowMin][iCol] = freqArray[iCol-1];
                }
            }
        }
        return(hit);
     }

    static void logVector(long lData)
    {
        if (use_connection)
        {
            try
            {
                coverageClient.sendData(new Long(lData));
            }
            catch (Exception e)
            {
                String errMsg = coverageClient.getErrorMessage();
                String[] text = {"ERROR: " + errMsg};

            // better QA 11358 begin
            try
            {
                if (shutDownInProgress == false)
                {
									  System.err.println("Coverage Info: " + text);
                }
            }
            catch (Exception ex){}
            catch (Error err){}    // end better QA11358
            }
        }
        else
        {
            synchronized (traceFile)
            {
                traceFile.println(lData);
            }
        }
    }

    static void logVector(int iData)
    {
        if (use_connection)
        {
            try
            {
                coverageClient.sendData(new Integer(iData));
            }
            catch (Exception e)
            {
                String errMsg = coverageClient.getErrorMessage();
                String[] text = {"ERROR: " + errMsg};

                //QA11358
                if (shutDownInProgress == false)
                {
										System.err.println("Coverage Info: " + text);
                }
            }
        }
        else
        {
            synchronized (traceFile)
            {
                traceFile.println(iData);
            }
        }
    }

    /**********************************************************************
     * Write path vectors for a module.  cache the vector and delay
     * writes for single path vectors.
     *
     * @param moduleId    Index of the module being processed
     * @param freqArray Current Path Vector
     * @param Kind        0 = single path, 1=cumulative
     *                    2 = event incidence 3 = testcomp record id
     **********************************************************************/
    static private void transmitVector(long moduleId,
                                       int[] freqArray,
                                       int  kind)
    {
        String buff;
        String str;
        int val;

        if(kind == 0 && cacheHit((int)moduleId, freqArray))
        {
            return;
        }

        // performance mod: batch all data into one write to coverage server
        // QA 11394 begin
        if (cs_buffered_vector && use_connection)
        {
            buff = kind + "\n" + (moduleId +8) + "\n";

            for (int i = 0; i < freqArray.length; i++)
            {
                if (i < (freqArray.length - 1))
                {
                    val = (freqArray[i] + 8);
                    str = val + "\n";
                }
                else
                {
                    val = (freqArray[i] + 8);
                    str = Integer.toString (val);
                }
                buff = buff.concat (str);
            }
            coverageClient.sendData (buff);
        } // QA11394 end
        else
        {
            logVector(kind);
            logVector((moduleId +8));

            if (use_connection)
            {
                coverageClient.displayTrace (moduleId);
            }
            if (kind == 2)
            {
                logVector(freqArray[0] + 8);
            }
            else if (kind == 3)
            {
                /* no vector for kind 3 */
            }
            else
            {
                for (int i = 0; i < freqArray.length; i++)
                    logVector(freqArray[i] + 8);
            }
        }
    }

    /**********************************************************************
     * Fill in the file offset in the per file data from the master list.
     *
     * @param info per-file data about the offset
     **********************************************************************/
    static void findFile(Object[] info)
    {
        boolean found_file = false;
        int i;
        int j;

        // QA11420 begin
        String fileSeparator = System.getProperty("file.separator","\\");
        char separator = '\\';
        if (fileSeparator.charAt(0) == '\\')
        {
            separator = '/';
        }
        String filename = (String) info[1];
        filename = filename.replace (separator,fileSeparator.charAt(0));
        // QA11420 end

        _McFileInfo_ERS_Iter3[] fileInfo ;

        for (j = 0; j < sdf_list.length; j++)
        {
            fileInfo = (_McFileInfo_ERS_Iter3 []) sdf_list [j];

            for (i = 0; i < fileInfo.length; i++)
            {
                String fileName = fileInfo[i].filename;    //QA11420
                fileName = fileName.replace (separator,fileSeparator.charAt(0));   //QA11420
                if (filename.compareTo(fileName) == 0)
                {
                    info[0] = new Integer(fileInfo[i].iModuleBase);
                    fileInfo[i].initialized = true;
                    found_file = true;
                    break;
                }
            }
        }
        if (found_file == false)
        {
            info[0] = new Integer(-2);
            System.err.println("No record of file " + filename);
        }
    }

    /**********************************************************************
     * Called when a method is entered when using PathVec_ERS_Iter3 Instrumentation.
     *
     * @param InstFileInfo Information about the file calling this function
     * @param ModuleIndex  Index for the module calling this function
     * @param freqArray    Branch frequency array
     * @param Event        Event Number
     * @param bCall        Is this a call event?
     **********************************************************************/
    static synchronized void processEvent(Object[] instFileInfo,
                                          long moduleIndex,
                                          int[] freqArray,
                                          int event,
                                          boolean bCall)
    {
        int iModReal;
        int iEventReal;
        boolean [] evr;
        int evr_index;
        int evr_list_index;

        int [] mmap;
        int mmap_index;
        int mmap_list_index;

        _McModInfo_ERS_Iter3[] moduleInfo;
        int sdm_list_index;
        int sdm_index;

        if (disableInstrumentation)
            return;

        /* For test compression -- if InstFileInfo is null then the
         * module index is a record sequence */
        if (instFileInfo == null)
        {
            transmitVector(moduleIndex,null,3);
            return;
        }

        if (((Integer)instFileInfo[0]).intValue() == -1)
        {
            findFile(instFileInfo);
        }
        if (((Integer)instFileInfo[0]).intValue() == -2)
        {
            return;
        }

        iModReal = (int)moduleIndex + ((Integer)instFileInfo[0]).intValue();
        mmap_list_index = get_mmap_list_index (iModReal);
        mmap_index = get_mmap_index (iModReal);
        mmap = (int []) modmap_list [mmap_list_index];
        iModReal = mmap [mmap_index];

        // iModReal = sdmod.moduleMap[iModReal];  - replaced by multi-class structure to get around
        // 64 k limit imposed by java
        sdm_list_index = get_sdm_list_index (iModReal);
        sdm_index = get_sdm_index (iModReal);
        moduleInfo = (_McModInfo_ERS_Iter3 []) sdm_list [sdm_list_index];
        iEventReal = event + moduleInfo[sdm_index].iEventBase;

        /* for Test Compression
         if added by altag to essentially eliminate the type 2 record output
         QA 11393 begin */
        if (test_compress_is_active)
        {
            int[] dummyArray = {event};
            if (eventFrequency[iEventReal] == 0)
                transmitVector(iModReal, dummyArray, 2);
        } //QA11393 end

        eventFrequency[iEventReal]++;
        if (!branchOnly)
        {
            if (bCall)
            {
                for(int i=0; i < moduleInfo[sdm_index].cEvents ; i++)
                {
                    freqArray[i] = 0;
                }
            }

            freqArray[event]++;
            evr_list_index = get_evr_list_index (iEventReal);
            evr_index = get_evr_index (iEventReal);
            evr = (boolean [])event_list [evr_list_index];

            // Enter if this is a terminal event, or if we are dealing with a freqArray
            // made by getIntArray() that needs flushed. A freqArray made by getIntArray
            // is recognizable by detecting an array length that does not match the modInfo
            // event count. For such an array, look at the last element, which is the
            // extra element allocated by getIntArray(), to be used as the flush indicator.
            // If it is 1, then the freqArray needs to be transmitted now.
            if (evr[evr_index] || (freqArray.length != moduleInfo[sdm_index].cEvents && freqArray[freqArray.length - 1] == 1))
            {
                if (hTable.containsKey(obtainThreadFrameId()))
                {
                    // If we get here, it means we encountered a terminal event, but
                    // the freqArray was made by getIntArray() and has not yet been
                    // released. Just set the flush indicator (last element, extra
                    // allocated by getIntArray()), so that we transmit on next event
                    // after release.
                    freqArray[freqArray.length - 1] = 1;
                }
                else
                {
                    // If a module's freqArray size is not equal to the number of events in it,
                    // then the module has an explicit constructor call. In other words, it has
                    // called getIntArray() for a freqArray whose size is MaxEvents (+1). We create
                    // a new vector whose size equal to the number of events in the module and copy
                    // that much from freqArray before we transmit.
                    if (freqArray.length != moduleInfo[sdm_index].cEvents)
                    {
                        freqArray[freqArray.length - 1] = 0;
                        int temp[] = new int[moduleInfo[sdm_index].cEvents];
                        for (int i=0; i < temp.length; i++)
                        {
                            temp[i] = freqArray[i];
                        }
                        freqArray = temp;
                    }
                    transmitVector(iModReal, freqArray, 0);
                }
            }
        }
    }

    static private int get_evr_index (int real_evr)
    {
        return (real_evr%MAX_EVR_SIZE);
    }

    static private int get_evr_list_index (int real_evr)
    {
        return (real_evr/MAX_EVR_SIZE);
    }

    static private int get_mmap_index (int real_evr)
    {
        return (real_evr%MAX_MODMAP_SIZE);
    }

    static private int get_mmap_list_index (int real_evr)
    {
        return (real_evr/MAX_MODMAP_SIZE);
    }

    static private int get_sdm_index (int real_evr)
    {
        return (real_evr%MAX_MI_SIZE);
    }

    static private int get_sdm_list_index (int real_evr)
    {
        return (real_evr/MAX_MI_SIZE);
    }

    /**********************************************************************
     * Called when a method is entered when using PathVec_ERS_Iter3 Instrumentation.
     *
     * @param instFileInfo Information about the file calling this function
     * @param moduleIndex  Index for the module calling this function
     * @param freqArray    Branch frequency array
     * @param event        Event Number
     **********************************************************************/
    public static void enterMethod(Object[] instFileInfo,
                                   int moduleIndex,
                                   int[] freqArray,
                                   int event)
    {
        processEvent(instFileInfo,moduleIndex, freqArray, event, true);
    }

    /**********************************************************************
     * Called when a constructor with explicit constructor call is entered
     * when using PathVec_ERS_Iter3 Instrumentation. Same as enterMethod() except for
     * the freqArray not being initialized since the array would have been
     * already initialized by a call to getIntArray() and may have some
     * branch frequencies.
     *
     * @param instFileInfo Information about the file calling this function
     * @param moduleIndex  Index for the module calling this function
     * @param freqArray    Branch frequency array
     * @param event        Event Number
     *
     * QAID-10109. This method is added by Ravi on 06/23/00.
     **********************************************************************/
    public static void enterConstructorWithECC(Object[] instFileInfo,
                                               int moduleIndex,
                                               int[] freqArray,
                                               int event)
    {
        processEvent(instFileInfo,moduleIndex, freqArray, event, false);
    }

    /**********************************************************************
     * Called when a decision is encountered when using PathVec_ERS_Iter3
     * Instrumentation.
     *
     * @param instFileInfo Information about the file calling this function
     * @param moduleIndex  Index for the module calling this function
     * @param freqArray
     * @param trueEvent   Event Number if the Condition is true
     * @param falseEvent  Event Number if the Condition is false
     * @param condition   The boolean value of the condition
     *
     * @return the value of Condition
     **********************************************************************/
    public static boolean decision(Object[] instFileInfo,
                                   int moduleIndex,
                                   int[] freqArray,
                                   int trueEvent,
                                   int falseEvent,
                                   boolean condition)
    {
        int event;

        if (condition)
        {
            event = trueEvent;
        }
        else
        {
            event = falseEvent;
        }
        // write Event to the Instrumentation file
        processEvent(instFileInfo,moduleIndex, freqArray, event, false);

        return (condition);
    }

    /**********************************************************************
     * Acts as a wrapper for the argument "condition" of the method
     * decision(...).
     *
     * @param Condition   The boolean value of the condition
     *
     * @return the value of Condition
     **********************************************************************/
    public static boolean testCondition(boolean condition)
    {
        return condition;
    }

    /**********************************************************************
     * Start a new record for test compression, return its index in
     * sequence.  Use a file info pointer of null as a flag to
     * process_event that it should expect the vector to have a single
     * element that is a kind 3 record index.
     *
     **********************************************************************/
    static long currentRecord = 0;

    public static synchronized long newRecord()
    {
        currentRecord++;
        processEvent(null, currentRecord, null, 0, false);
        return currentRecord;
    }
}

/**********************************************************************
 * McCabe Instrumentation Class.  This class is instantiated so the
 * finalize function is called when the program exits
 *
 * @author McCabe & Associates, Inc.
 **********************************************************************/

// begin QA11390



// end QA11390

/**********************************************************************
 * Module info.  This stores information about each module in the
 * program.
 **********************************************************************/
class _McModInfo_ERS_Iter3
{
    int cEvents;
    int iEventBase;
    int cCacheRows;
    private int[][] cache;

    /**********************************************************************
     * Construct the Module info object.
     *
     * @param cEvents    Number of events in this module
     * @param iEventBase Base number for this module
     * @param cCacheRows Number of rows to cache
     **********************************************************************/
    _McModInfo_ERS_Iter3(int cEvents, int iEventBase, int cCacheRows)
    {
        this.cEvents = cEvents;
        this.iEventBase = iEventBase;
        this.cCacheRows = cCacheRows;
        cache = null;
    }

    /**
     * To get the cache
     * provides load on demand.
     */
    public int [] [] getCache()
    {
        if (cache == null)
        {
        cache = new int[cCacheRows][cEvents+1];
        }
        return cache;
    }

}

/**********************************************************************
 * Informat about each file in the program.  An array of _McFileInfo_ERS_Iter3
 * object is created with one entry for each source file in the
 * program.
 **********************************************************************/
class _McFileInfo_ERS_Iter3
{
    String filename;
    int iModuleBase;
    int cModules;
    int iModuleCompBase;
    boolean initialized;

    /**********************************************************************
     * Construct an _McFileInfo_ERS_Iter3 object.
     *
     * @param filename        Source file name
     * @param iModuleBase     Offset of the first module in this file
     * @param cModules        Number of modules in this file
     * @param iModuleCompBase Compressed offset of the modules
     * @param initialized     Has this local class been initialized from this
     **********************************************************************/
    _McFileInfo_ERS_Iter3(String filename,
               int iModuleBase,
               int cModules,
               int iModuleCompBase,
               boolean initialized)
    {
        this.filename = filename;
        this.iModuleBase = iModuleBase;
        this.cModules = cModules;
        this.iModuleCompBase = iModuleCompBase;
        this.initialized = initialized;
    }
}
